<template>
	<div id="doctorAuth">
		<header>身份选择</header>
		<div>
			<label @change="select()" class='patientBox'>
				<img src="../image/icon_doctor@2x_03.png" width='74' height="74" alt="">
				<input type="radio" v-model="userAuth" value='doctor'>
				<i>我是医生</i>
			</label>	
        </div>
        <div>
            <label @change="select()" class='patientBox'>
				<img src="../image/icon_clinic@2x_03.png" width='74' height="74" alt="">
				<input type="radio" v-model="userAuth" value='clinic'>
				<i>我是诊室</i>
			</label>
        </div>
        <div>
			<label @change="select()" class='patientBox'>
				<img src="../image/icon_patients@2x.png" width='74' height="74" alt="">
				<input type="radio" v-model="userAuth" value='patient'>
				<i>我是客户</i>
			</label>
		</div>
	</div>
</template>
<script>
	export default {
		data() {
			return {
                userid: '',
                usertype: '',  //当前用户身份
				userAuth: '',  //身份 医生还是诊室 患者
			}
		},
		methods: {
            //用户id
            init() {
                this.userid = localStorage.getItem("loginMobile");
            },
            //选择身份
			select() {
				if(this.userAuth == 'doctor') { 
                    this.$api.get(this.$api.baseURLSchool,"select_cid/user/"+this.userid,{},r => {
                        console.log(r);
                        if(r.data.ret == 1) {
                            if(r.data.info.per_app_status=="1") {
                                this.$router.push({name:'doctorvipAuth1'});
                            } else {
                                this.$router.push({name:'authentication'});
                            }
                        }
                    },err => {
                        console.log(err);
                    })
				}else if(this.userAuth == 'clinic') {
                    this.$api.get(this.$api.baseURLSchool,"select_cid/user/"+this.userid,{},r => {
                        console.log(r);
                        if(r.data.ret == 1) {
                            if(r.data.info.org_app_status=="1") {
                                this.$router.push({name:'ImClinic'});
                            } else {
                                this.$router.push({name:'clinicAddress'});
                            }
                        }    
                    },err => {
                        console.log(err);
                    })
				}else if(this.userAuth == 'patient') {
					this.$router.push({name: 'ImPatient'});
				}
				// console.log(this.userAuth);
			},
		},
		created() {
            this.init();
            // this.select();
        },
        
	}

</script>
<style lang="scss" scoped>
    
</style>